import axios from '@/libs/axios1'
import { escape2Html, html2Escape } from '@/libs/utils'
import { param } from 'jquery'
let jsonHeaders = { 'content-type': 'application/json;charset=UTF-8' }
import qs from 'qs'
const competeUrl = '/compete'
//护网下获取靶机
export const getPneAttackTarget = (params) => {
  return axios({
    url: `/compete/topoTargetAllot/page`,
    method: 'get',
    params,
    headers: jsonHeaders
  })
}
export const getPneDefenseTarget = (params) => {
  return axios({
    url: `/compete/targetAdmin/new/topoTargetList`,
    method: 'get',
    params,
    headers: jsonHeaders
  })
}
/****      竞赛演练场景增删改查相关               ****/
/**
 * 恢复暂停的竞赛
 * @param id 指定要恢复的比赛
 * @returns {*}
 */
//演练针对团队评价
export const addRemark = (data) => {
  return axios({
    url: `/compete/contest/addRemark`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}
export const getRemarkList = (sceneId, projectId) => {
  return axios({
    url: `/compete/contest/getRemark/${sceneId}/${projectId}`,
    method: 'get',
    headers: jsonHeaders
  })
}
export const deleteRemark = (data) => {
  return axios({
    url: `/compete/contest/delRemark`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}
export const updateRemark = (data) => {
  return axios({
    url: `/compete/contest/updateRemark`,
    method: 'put',
    data: data,
    headers: jsonHeaders
  })
}
//同步题目附件
export const synchronizeAttachments = (sceneId) => {
  return axios({
    url: `${competeUrl}/contest/distRangeSyncQuestionAttachment/${sceneId}`,
    method: 'post',
    headers: jsonHeaders
  })
}
//查询所有靶场
export const queryAllRange = () => {
  return axios({
    url: `/range-manager/unsafe/range`,
    method: 'get',
    headers: jsonHeaders
  })
}
//查询分靶场准备情况
export const queryRangeInformation = (sceneId) => {
  return axios({
    url: `${competeUrl}/contest/queryRangePrepare/${sceneId}`,
    method: 'get',
    headers: jsonHeaders
  })
}
export const issueCompetitionData = (sceneId) => {
  return axios({
    url: `${competeUrl}/contest/distRangeContestData/${sceneId}`,
    method: 'post',
    headers: jsonHeaders
  })
}
//下发分布式竞赛数据
export const issueAccessGroup = (testId) => {
  return axios({
    url: `/process/tests/${testId}/group/sync`,
    method: 'POST',
    headers: jsonHeaders
  })
}
export const restoreCompetition = (id) => {
  return axios({
    url: `${competeUrl}/contest/resume/${id}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//查询竞赛列表
export const getSceneList = (params) => {
  return axios({
    url: `${competeUrl}/contest/page`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//新增竞赛
export const addScene = (data) => {
  return axios({
    url: `${competeUrl}/contest`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

//修改竞赛
export const modifyScene = (id, data) => {
  return axios({
    url: `${competeUrl}/contest/${id}`,
    method: 'put',
    data: data,
    headers: jsonHeaders
  })
}

//修改竞赛的工程名称
export const modifyScenePrjname = (id, data) => {
  return axios({
    url: `${competeUrl}/contest/updateProjectName`,
    method: 'put',
    data: data,
    headers: jsonHeaders
  })
}

//获取竞赛详情
export const getSceneInfo = (id) => {
  return axios({
    url: `${competeUrl}/contest/${id}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//删除竞赛
export const delScene = (id, isDelTest) => {
  return axios({
    url: `${competeUrl}/contest/${id}?isDelTest=${isDelTest}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//场景周期配置
export const setSceneCycle = (sceneId) => {
  return axios({
    url: `${competeUrl}/cycle/${sceneId}`,
    method: 'post',
    headers: jsonHeaders
  })
}

//获取当前周期
export const getSceneCycle = (sceneId) => {
  return axios({
    url: `${competeUrl}/cycle/${sceneId}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//延长比赛时增加周期
export const addSceneCycle = (sceneId) => {
  return axios({
    url: `${competeUrl}/cycle/${sceneId}`,
    method: 'put',
    data: {},
    headers: jsonHeaders
  })
}

//获取总周期数
export const getSceneCycleNum = (sceneId) => {
  return axios({
    url: `${competeUrl}/cycle/total/${sceneId}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//更新比赛进度
export const updateSceneProgress = (id, state) => {
  return axios({
    url: `${competeUrl}/contest/updateState/${id}?state=${state}`,
    method: 'put',
    headers: jsonHeaders
  })
}

// 获取所有工程
export const getProjects = (params) => {
  return axios({
    url: `/topo-edit/projects`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//2019-12-23
//获取工程下的场景列表
export const getTests = (params) => {
  return axios({
    // url: `/process/tests`,
    url: `process/jz/project/process`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

// 获取工程下的场景中的设备信息
export const getTestsEditor = (sceneId) => {
  return axios({
    url: `/process/tests/${sceneId}/editor`,
    method: 'get',
    headers: jsonHeaders
  })
}

//删除工程下得场景
export const delTest = (id) => {
  return axios({
    url: `/process/tests/${id}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//获取场景工程
export const getSceneProject = (params) => {
  return axios({
    url: `/competetopo/projects`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

export const getProjectInfo = (projectId) => {
  return axios({
    url: `/competetopo/projects/${projectId}`,
    method: 'get',
    headers: jsonHeaders
  })
}
/****** 竞赛演练场景增删改查相关  ******/

/******对抗演练靶机(目标队伍)******/
//查询目标列表
export const getTargetTeamList = (params) => {
  return axios({
    url: `${competeUrl}/targetTeam/page`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

/******对抗演练靶机(目标队伍)******/
// 批量修改Flag路径
export const updataFlagServePath = (params) => {
  return axios({
    url: `${competeUrl}/target/upBatch`,
    method: 'put',
    data: params,
    headers: jsonHeaders
  })
}

//新增目标
export const addTargetTeam = (data) => {
  return axios({
    url: `${competeUrl}/targetTeam`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

//修改目标
export const modifyTargetTeam = (data) => {
  return axios({
    url: `${competeUrl}/targetTeam/${data.id}`,
    method: 'put',
    data: data,
    headers: jsonHeaders
  })
}

//获取目标详情
export const getTargetTeamInfo = (id) => {
  return axios({
    url: `${competeUrl}/targetTeam/${id}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//删除目标
export const delTargetTeam = (id) => {
  return axios({
    url: `${competeUrl}/targetTeam/${id}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//查询目标列表
export const getTargetTempInfoList = (params) => {
  return axios({
    url: `${competeUrl}/targetTempInfo/page`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//新增目标临时信息
export const addTargetTempInfo = (data) => {
  return axios({
    url: `${competeUrl}/targetTempInfo`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

//修改临时信息
export const modifyTargetTempInfo = (data) => {
  return axios({
    url: `${competeUrl}/targetTempInfo/${data.id}`,
    method: 'put',
    data: data,
    headers: jsonHeaders
  })
}

//获取目标临时信息详情
export const getTargetTempInfo = (id) => {
  return axios({
    url: `${competeUrl}/targetTempInfo/${id}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//删除目标临时信息
export const delTargetTempInfo = (id) => {
  return axios({
    url: `${competeUrl}/targetTempInfo/${id}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

/******对抗演练靶机(目标队伍)******/

//查询工程下的虚拟机
export const queryVmWithParty = (projectId, params) => {
  return axios({
    url: `/topo-edit/vm/list/${projectId}`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//查询工程下的虚拟机(靶标,题目)
export const queryDeployedVms = (projectId, params) => {
  return axios({
    url: `/topo-edit/deployed/projects/${projectId}/vms`,
    method: 'get',
    params: params,
    headers: jsonHeaders,
    paramsSerializer: (params) => {
      return qs.stringify(params, { indices: false })
    }
  })
}

//对指定工程下所有虚拟机执行操作
export const batchOpVm = (projectId, action) => {
  return axios({
    url: `/topo-control/servers/batch/action/${action}?projectId=${projectId}`,
    method: 'post',
    data: {},
    headers: jsonHeaders
  })
}

//查询批量执行记录
export const batchOpVmLog = (params) => {
  return axios({
    url: `/topo-control/servers/batch/action/logs`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

export const batchOpVmLogOnce = (id) => {
  return axios({
    url: `/topo-control/servers/batch/action/logs/${id}`,
    method: 'get',
    params: {},
    headers: jsonHeaders
  })
}

//重置虚拟机
export const rebuildVm = (id) => {
  return axios({
    url: `/topo-control/servers/${id}/rebuild`,
    method: 'post',
    data: {},
    headers: jsonHeaders
  })
}
/*********************统计相关**********************/
//获取靶标异常日志
export const targetExceptionLog = (params) => {
  return axios({
    url: `${competeUrl}/checkRecord/page`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//获取攻防和红蓝靶标异常日志
export const awdTargetExceptionLog = (sceneId, params) => {
  return axios({
    url: `${competeUrl}/checkRecord/awd/${sceneId}`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//获取异常详情
export const targetExceptionDetail = (sceneId, params) => {
  return axios({
    url: `${competeUrl}/checkRecord/detail/${sceneId}`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//积分计算
//export const integralCalc = sceneId => {
//return axios({
//  url: `${competeUrl}/integral/${sceneId}`,
//  method: 'post',
//  headers: jsonHeaders
//})
//}

//获取积分列表(团队积分和个人积分)
//export const getIntegralList = (sceneId,type,params) => {
//return axios({
//  url: `${competeUrl}/integral/${sceneId}/${type}`,
//  method: 'get',
//  params:params,
//  headers: jsonHeaders
//})
//}
//演练竞赛报告中团队得分表格统计
export const competDrillTableTeamStatistics = (data) => {
  return axios({
    url: `/compete/integral/statisticTableTeam`,
    data: data,
    method: 'post',
    headers: jsonHeaders
  })
}
//实验员报告中团队和个人演练竞赛得分表格统计
export const competDrillTableStatistics = (userId, data, params) => {
  return axios({
    url: `/compete/integral/statisticTable/${userId}`,
    data: data,
    params: params,
    method: 'post',
    headers: jsonHeaders
  })
}
//实验员报告中团队和个人演练竞赛得分趋势情况统计
export const competDrillintegral = (userId, data) => {
  return axios({
    url: `/compete/integral/statistic/${userId}`,
    data: data,
    method: 'post',
    headers: jsonHeaders
  })
}
//报告(所有演练和竞赛共用)
export const competeReport = (sceneId) => {
  return axios({
    url: `${competeUrl}/integral/export/${sceneId}`,
    method: 'get',
    headers: jsonHeaders
  })
}

/*********************统计相关**********************/
//删除工程
export const delProject = (id) => {
  return axios({
    url: `/topo-edit/project/delete/${id}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//获取工程下的虚拟机()
//export const getProjectSevers = params => {
//return axios({
//  url: `/deploy/project/servers`,
//  method: 'get',
//  params:params,
//  headers: jsonHeaders
//})
//}

//获取工程下所有的虚拟机 (drill里面有了)
//export const getAllVm = params => {
//return axios({
//  url: `/deploy/project/servers`,
//  method: 'get',
//  params:params,
//  headers: jsonHeaders
//})
//}

/****************实物设备相关*******************/
//1、添加申请实物设备
export const addPRApply = (params) => {
  return axios({
    url: `${competeUrl}/physicalResourceApply`,
    method: 'post',
    data: params,
    headers: jsonHeaders
  })
}
//累计添加申请实物设备
export const multiAddPRApply = (params) => {
  return axios({
    url: `${competeUrl}/physicalResourceApply/${params.id}`,
    method: 'post',
    data: params.data,
    headers: jsonHeaders
  })
}
//2、获取topo下需要的实物设备节点
export const getPhyDevNodeList = (params) => {
  return axios({
    url: `/topo-edit/project/physicals`,
    method: 'get',
    headers: jsonHeaders,
    params: params
  })
}
//根据网络id获取子网id
export const getSubnetId = (projectId, networkId, deviceId, params) => {
  return axios({
    url: `/topo-edit/topo/${projectId}/${networkId}/device/${deviceId}/subnets`,
    method: 'get',
    headers: jsonHeaders,
    params: params
  })
}
//获取申请的实物设备
export const getApplyPhyDevice = (id) => {
  return axios({
    url: `${competeUrl}/physicalResourceApply/getPhyDeviceInfo/${id}`,
    method: 'get',
    headers: jsonHeaders
  })
}
//绑定实物设备和实物节点
export const bindPhyDevNode = (taskId, data) => {
  return axios({
    url: `${competeUrl}/physicalResourceApply/pda/${taskId}`,
    method: 'put',
    data,
    headers: jsonHeaders
  })
}
//修改申请实物设备
export const modifyPRApply = (id, params) => {
  return axios({
    url: `${competeUrl}/physicalResourceApply/${id}`,
    method: 'put',
    data: params,
    headers: jsonHeaders
  })
}

//删除申请实物设备
export const delPRApply = (id) => {
  return axios({
    url: `${competeUrl}/physicalResourceApply/${id}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//断开实物设备接入
export const breakInput = (id) => {
  return axios({
    url: `${competeUrl}/physicalResourceApply/undoDeviceAccess/${id}`,
    method: 'delete',
    headers: jsonHeaders
  })
}
//恢复实物设备接入
export const reconnectInput = (params) => {
  return axios({
    url: `${competeUrl}/physicalResourceApply/deviceAccessSubnet/${params.id}?subnetId=${params.subnetId}`,
    method: 'get',
    headers: jsonHeaders
  })
}
//查询申请列表
export const queryPRApplyList = (params) => {
  return axios({
    //url: `${competeUrl}/physicalResourceApply/page`,
    url: `${competeUrl}/physicalResourceApply/page`,
    //url:`${competeUrl}/physicalResourceApply/page?pageIndex=1&pageSize=20&sceneId=b0ef88dcf5264c63804397decdc22762`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}
/********实物设备申请相关结束******/

//查询子网络列表
export const queryNetworkList = (projectId, networkId) => {
  return axios({
    url: `/topo-edit/topo/projects/${projectId}/networks/${networkId}/load_topology`,
    method: 'get',
    headers: jsonHeaders
  })
}

/**********攻防&渗透靶机(目标队伍)**********/
//查询目标列表
export const getTargetTeamList_new = (params) => {
  // 统一处理，查询目标分配不再需要传递工程ID，否则会导致工程再次构件后，查询不出数据
  delete params.projectId
  return axios({
    url: `${competeUrl}/target/page`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//新增目标
export const addTargetTeam_new = (data) => {
  return axios({
    url: `${competeUrl}/target`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

// 批量添加靶标题目
export const batchAddTarget = (data) => {
  return axios({
    url: `${competeUrl}/target/batch`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

/**
 * 添加并且分配题目
 * @param {*} sceneId
 * @param {*} data
 * @returns
 */
export const addAndAllocationTarget = (sceneId, data) => {
  return axios({
    url: `${competeUrl}/target/batchAddQuestion/${sceneId}`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

//修改目标
export const modifyTargetTeam_new = (data) => {
  return axios({
    url: `${competeUrl}/target/${data.id}`,
    method: 'put',
    data: data,
    headers: jsonHeaders
  })
}

//获取目标详情
export const getTargetTeamInfo_new = (id) => {
  return axios({
    url: `${competeUrl}/target/${id}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//删除目标
export const delTargetTeam_new = (id) => {
  return axios({
    url: `${competeUrl}/target/${id}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//靶标分配
export const targetAllot = (params) => {
  return axios({
    url: `${competeUrl}/targetAllot`,
    method: 'post',
    data: params,
    headers: jsonHeaders
  })
}

/**
 * 获取团队已申请的提示记录
 * @param {*} param
 * @returns
 */
export const getUserApplyTipRecord = (param) => {
  return axios({
    url: `${competeUrl}/targetAllot/queryApplyQuestionPromptRecord/${param.sceneId}`,
    method: 'get',
    param,
    headers: jsonHeaders
  })
}

//修改靶标分配
export const modifyTargetAllot = (id, params) => {
  return axios({
    url: `${competeUrl}/targetAllot/${id}`,
    method: 'put',
    data: params,
    headers: jsonHeaders
  })
}

// 查询分配后靶标配置列表
export const queryTargetAllot = (params) => {
  return axios({
    url: `${competeUrl}/targetAllot/page`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//查询靶机配置关系列表
export const queryTargetAllotRelation = (params) => {
  return axios({
    url: `${competeUrl}/targetAllot/relation/page`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//创建虚拟路由器与ip关系
export const VRIPRelation = (params) => {
  return axios({
    url: `${competeUrl}/ad/VRIPRelation`,
    method: 'post',
    data: params,
    headers: jsonHeaders
  })
}

//修改靶机用户名密码
export const modifyPwd = (data) => {
  return axios({
    url: `${competeUrl}/targetAllot/change`,
    method: 'put',
    data,
    headers: jsonHeaders
  })
}

//删除团队下分配的靶机
export const delGroupTarget = (sceneId, teamId) => {
  return axios({
    url: `${competeUrl}/targetAllot/${sceneId}/${teamId}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//自动创建攻防赛靶标
export const aotoGenarateTargets = (id) => {
  return axios({
    url: `${competeUrl}/target/auto/${id}`,
    method: 'post',
    headers: jsonHeaders
  })
}

// 删除团队分配的题目
export const delAssignedTopics = (sceneId, teamId) => {
  return axios({
    url: `${competeUrl}/ctfGameBox/del/${sceneId}/${teamId}`,
    method: 'delete',
    headers: jsonHeaders
  })
}
/*****************攻防对抗渗透靶标**************/

/*****************护网靶标开始**************/
//新增目标
export const addTopoTarget = (data) => {
  return axios({
    url: `${competeUrl}/topoTarget/${data.id}?testId=${data.testId}&projectId=${data.projectId}`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}
export const addTopoTargetNew = (data, id) => {
  return axios({
    url: `${competeUrl}/topoTarget?testId=${id}`,
    method: 'post',
    data,
    headers: jsonHeaders
  })
}

export const addTopoTarget_old = (data) => {
  return axios({
    url: `/compete/old/topoTarget`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

//修改目标
export const modifyTopoTarget = (data) => {
  return axios({
    url: `${competeUrl}/topoTarget/${data.id}?testId=${data.testId}&projectId=${data.projectId}`,
    method: 'put',
    data: data,
    headers: jsonHeaders
  })
}

export const modifyTopoTarget_old = (data) => {
  return axios({
    url: `/compete/old/topoTarget/${data.id}?testId=${data.testId}&projectId=${data.projectId}`,
    method: 'put',
    data: data,
    headers: jsonHeaders
  })
}

//获取目标详情
export const getTopoTargetInfo = (id) => {
  return axios({
    url: `${competeUrl}/topoTarget/${id}`,
    method: 'get',
    headers: jsonHeaders
  })
}

export const getTopoTargetInfo_old = (id) => {
  return axios({
    url: `/compete/old/topoTarget/${id}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//删除目标
export const delTopoTarget = (id, projectId) => {
  return axios({
    url: `${competeUrl}/topoTarget/${id}?projectId=${projectId}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

export const delTopoTarget_old = (id, projectId) => {
  return axios({
    url: `/compete/old/topoTarget/${id}?projectId=${projectId}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//查询目标列表
export const getTopoTargetList = (params) => {
  return axios({
    url: `${competeUrl}/topoTarget`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

export const getTopoTargetList_old = (params) => {
  return axios({
    url: `/compete/old/topoTarget`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//导入靶标信息
export const importTarget = (projectId, data) => {
  return axios({
    url: `${competeUrl}/topoTarget/projects/${projectId}/input`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

export const importTarget_old = (projectId, data) => {
  return axios({
    url: `/compete/old/topoTarget/projects/${projectId}/input`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

//靶标分配
export const allotTopoTarget = (data, sceneId) => {
  return axios({
    url: `${competeUrl}/topoTargetAllot?sceneId=${sceneId}`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

export const allotTopoTarget_old = (data, sceneId) => {
  return axios({
    url: `/compete/old/topoTargetAllot?sceneId=${sceneId}`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

//自动分配靶标
export const autoAllotTopoTarget = (sceneId) => {
  return axios({
    url: `${competeUrl}/targetAllot/auto/${sceneId}`,
    method: 'post',
    headers: jsonHeaders
  })
}

//一键分配护网公共靶标
export const batchAllotTopoTarget = (sceneId) => {
  return axios({
    url: `${competeUrl}/topoTarget/batch/${sceneId}`,
    method: 'post',
    headers: jsonHeaders,
    timeout: 600000
  })
}

//批量设置成公共靶标
export const batchSetTopoTargetPublic = (sceneId, ids) => {
  return axios({
    url: `${competeUrl}/topoTarget/pub/${sceneId}`,
    method: 'post',
    headers: jsonHeaders,
    data: ids
  })
}

//单位下所有靶标变更单位名
export const updateTargetCompany = (sceneId, data) => {
  return axios({
    url: `${competeUrl}/topoTarget/change/${sceneId}`,
    method: 'put',
    headers: jsonHeaders,
    data: data
  })
}

//批量删除靶标分配
export const batchDeleteTopoAllotTarget = (ids) => {
  return axios({
    url: `${competeUrl}/topoTargetAllot/del`,
    method: 'delete',
    headers: jsonHeaders,
    data: ids
  })
}

//查询分配列表
export const queryAllotTopoTargetList = (params) => {
  return axios({
    url: `${competeUrl}/topoTargetAllot/page`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

export const queryAllotTopoTargetList_old = (params) => {
  return axios({
    url: `/compete/old/topoTargetAllot/page`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//删除分配信息
export const delTopoTargetAllot = (id) => {
  return axios({
    url: `${competeUrl}/topoTargetAllot/${id}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

export const delTopoTargetAllot_old = (id) => {
  return axios({
    url: `/compete/old/topoTargetAllot/${id}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

// 删除团队已分配的目标
export const delTeamTarget = (sceneId, teamId) => {
  return axios({
    url: `${competeUrl}/topoTargetAllot/deleteTeamTargetByTeamId/${sceneId}/${teamId}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

export const delTeamTarget_old = (sceneId, teamId) => {
  return axios({
    url: `/compete/old/topoTargetAllot/deleteTeamTargetByTeamId/${sceneId}/${teamId}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//获取场景下队伍分配靶标信息
export const getSceneTeamTarget = (sceneId) => {
  return axios({
    url: `${competeUrl}/topoTargetAllot/sceneTeamTarget/${sceneId}`,
    method: 'get',
    headers: jsonHeaders
  })
}

export const getSceneTeamTarget_old = (sceneId) => {
  return axios({
    url: `/compete/old/topoTargetAllot/sceneTeamTarget/${sceneId}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//改变靶标状态
export const changeAvailable = (id, params) => {
  return axios({
    url: `${competeUrl}/topoTargetAllot/${id}`,
    method: 'put',
    data: params,
    headers: jsonHeaders
  })
}

export const changeAvailable_old = (id, params) => {
  return axios({
    url: `/compete/old/topoTargetAllot/${id}`,
    method: 'put',
    data: params,
    headers: jsonHeaders
  })
}

//靶机统计
export const topoTargetStatis = (params) => {
  return axios({
    url: `/referee/internal/attack/count`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//防守方靶机统计
export const topoAtTargetStatis = (sceneId, params) => {
  return axios({
    url: `${competeUrl}/topoTarget/at/${sceneId}`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//攻击方靶标统计
export const topoDeTargetStatis = (sceneId, params) => {
  return axios({
    url: `${competeUrl}/topoTarget/de/${sceneId}`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//查询护网靶标区域
export const getDistricts = (params) => {
  return axios({
    url: `/topo-edit/topo/districts`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//导出靶标管理员列表
export const exportAdminExcel = (params) => {
  return axios({
    url: `${competeUrl}/targetAdmin/exportExcel`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

export const exportAdminExcel_old = (params) => {
  return axios({
    url: `/compete/old/targetAdmin/exportExcel`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//分配靶标位置POST
export const assignTopoTargetPos = (projectId) => {
  return axios({
    url: `${competeUrl}/topoTarget/project/${projectId}/position/assign`,
    method: 'post',
    headers: jsonHeaders
  })
}

export const assignTopoTargetPos_old = (projectId) => {
  return axios({
    url: `/compete/old/topoTarget/project/${projectId}/position/assign`,
    method: 'post',
    headers: jsonHeaders
  })
}

//校验区域靶标位置数量
export const checkTopoTargetPosNum = (projectId) => {
  return axios({
    url: `${competeUrl}/topoTarget/project/${projectId}/position/check`,
    method: 'post',
    headers: jsonHeaders
  })
}

//下线目标
export const lineTarget = (id) => {
  return axios({
    url: `${competeUrl}/topoTarget/line/${id}`,
    method: 'put',
    data: {},
    headers: jsonHeaders
  })
}

export const checkTopoTargetPosNum_old = (projectId) => {
  return axios({
    url: `/compete/old/topoTarget/project/${projectId}/position/check`,
    method: 'post',
    headers: jsonHeaders
  })
}

/********************护网靶标结束*********************/

/*****************ctf靶标**************/
export const addAndAssignCtfQuestion = (sceneId, ctfQuestions) => {
  return axios({
    url: `${competeUrl}/ctfGameBox/saveCtfQuestion/${sceneId}`,
    method: 'post',
    data: ctfQuestions,
    headers: jsonHeaders
  })
}

//修改目标
export const modifyCtfTarget = (data) => {
  return axios({
    url: `${competeUrl}/ctfPaper/${data.id}`,
    method: 'put',
    data: data,
    headers: jsonHeaders
  })
}

//批量修改目标
export const batchModifyCtfTarget = (sceneId, data) => {
  return axios({
    url: `${competeUrl}/ctfPaper/batch/${sceneId}`,
    method: 'put',
    data: data,
    headers: jsonHeaders
  })
}
//查询靶标
export const queryCtfTarget = (sceneId, params) => {
  let copy = Object.assign({}, params) // 拷贝一份，不然有影响到页面数据
  if (
    copy.submitFlag === undefined &&
    copy.isNeedSubmitFlag !== undefined &&
    copy.isNeedSubmitFlag.trim() !== ''
  ) {
    copy.submitFlag = Number(copy.isNeedSubmitFlag)
  }
  if (copy.needEnv === undefined && copy.isNeedEnv !== undefined && copy.isNeedEnv.trim() !== '') {
    copy.needEnv = Number(copy.isNeedEnv)
  }
  if (
    copy.flagType === undefined &&
    copy.isFixedFileFlag !== undefined &&
    copy.isFixedFileFlag.trim() !== ''
  ) {
    copy.flagType = String(copy.isFixedFileFlag)
  }
  return new Promise((resolve) => {
    axios({
      url: `${competeUrl}/ctfPaper/${sceneId}`,
      method: 'get',
      params: copy,
      headers: jsonHeaders
    }).then((res) => {
      if (res && res.data && res.data.items) {
        // 将接口返回的数据结构转化为页面所需的数据结构
        res.data.items = res.data.items.map((item) => {
          item.isFixedFileFlag = item.flagType
          item.flag = item.flagTxt
          item.isNeedSubmitFlag = String(item.submitFlag)
          item.chaId = item.id
          item.isNeedEnv = item.needEnv ? '1' : '0'
          return item
        })
      }
      resolve(res)
    })
  })
}

//清空靶标
export const clearTarget = (sceneId) => {
  return axios({
    url: `${competeUrl}/ctfPaper/${sceneId}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//删除靶标
export const delCtfTarget = (id) => {
  return axios({
    url: `${competeUrl}/ctfPaper/byId/${id}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//ctf靶标分配
export const ctfTargetAllot = (params) => {
  return axios({
    url: `compete/ctfGameBox`,
    method: 'post',
    data: params,
    headers: jsonHeaders
  })
}

//查询ctf靶标分配
export const queryCtfTargetAllot = (params) => {
  // 需要拷贝一份传参，否则会影响页面
  let paramsObj = Object.assign({}, params)
  if (paramsObj && paramsObj.category) {
    paramsObj.category = html2Escape(paramsObj.category)
  }
  return new Promise((resolve) => {
    axios({
      url: `compete/ctfGameBox`,
      method: 'get',
      params: paramsObj,
      headers: jsonHeaders
    }).then((res) => {
      if (res && res.data && res.data.items) {
        res.data.items = res.data.items.map((item) => {
          item.category = escape2Html(item.category)
          return item
        })
      }
      resolve(res)
    })
  })
}

//查询提示
export const queryCtfTargetTags = (params) => {
  return axios({
    url: `compete/ctfTargetInfo/page`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//添加提示
export const createCtfTargetTags = (params) => {
  return axios({
    url: `compete/ctfTargetInfo`,
    method: 'post',
    data: params,
    headers: jsonHeaders
  })
}

//修改提示
export const modifyCtfTargetTags = (params) => {
  return axios({
    url: `compete/ctfTargetInfo/${params.id}`,
    method: 'put',
    data: params,
    headers: jsonHeaders
  })
}

//删除提示
export const delCtfTargetTags = (id) => {
  return axios({
    url: `${competeUrl}/ctfTargetInfo/${id}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//清空提示
export const clearCtfTargetTags = (targetId) => {
  return axios({
    url: `${competeUrl}/ctfTargetInfo/relation/${targetId}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//改变提示状态
export const changeTagVisible = (tagsId, tagVisibility) => {
  return axios({
    url: `${competeUrl}/ctfGameBox/${tagsId}/${tagVisibility}`,
    method: 'put',
    headers: jsonHeaders
  })
}

//提交flag
export const submitFlag = (params) => {
  return axios({
    url: `${competeUrl}/ctfGameBox/submit`,
    method: 'post',
    data: params,
    headers: jsonHeaders
  })
}

//评分
export const reportGrade = (params) => {
  return axios({
    url: `${competeUrl}/ctfReport/grade`,
    method: 'post',
    data: params,
    headers: jsonHeaders
  })
}

//获取解题报告信息
export const ctfReport = (sceneId, teamId, params) => {
  return axios({
    url: `${competeUrl}/ctfReport/${sceneId}/${teamId}`,
    method: 'get',
    headers: jsonHeaders,
    params
  })
}

//设计师提交报告
export const designerSubmitReport = (params) => {
  return axios({
    url: `${competeUrl}/ctfReport/designer`,
    method: 'post',
    data: params,
    headers: jsonHeaders
  })
}

//ctf赛修改提交记录取消状态
export const modifyUserSubmitRecordStatus = (id, status) => {
  return axios({
    url: `${competeUrl}/userSubmitRecord/${id}?status=${status}`,
    method: 'put',
    headers: jsonHeaders
  })
}

//切换环境修改vmId
export const switchCtfGameBox = (sceneId, data) => {
  return axios({
    url: `${competeUrl}/ctfGameBox/sw/${sceneId}`,
    method: 'put',
    data,
    headers: jsonHeaders
  })
}

//手动修改题目分配
export const modifyTargetAssign = (sceneId, data) => {
  return axios({
    url: `${competeUrl}/ctfGameBox/hand/${sceneId}`,
    method: 'put',
    data,
    headers: jsonHeaders
  })
}

//隐藏所有题目
export const hideAllTarget = (sceneId) => {
  return axios({
    url: `${competeUrl}/ctfPaper/all/${sceneId}`,
    method: 'put',
    data: {},
    headers: jsonHeaders
  })
}
/******************ctf靶标******************/

/**********************任务相关**********************/

//给任务分配裁判
export const taskReferee = (params) => {
  return axios({
    url: `/referee/designer/referee`,
    method: 'post',
    data: params,
    headers: jsonHeaders
  })
}

//查询任务分配裁判
export const queryTaskReferee = (taskId) => {
  return axios({
    url: `/referee/designer/referee/${taskId}`,
    method: 'get',
    headers: jsonHeaders
  })
}
/****************快速构建开始*******************/
export const ctfQuestionIncrement = (contestId, data, params) => {
  return axios({
    url: `${competeUrl}/auto/addtimu/${contestId}`,
    method: 'post',
    data,
    params,
    headers: jsonHeaders
  })
}
export const quickCreateContest = (data) => {
  return axios({
    url: `${competeUrl}/auto/build`,
    method: 'post',
    data,
    headers: jsonHeaders
  })
}
//接入机器分配方式不同使用不同的快速构建接口
export const quickCreateContestMacth = (data) => {
  return axios({
    url: `${competeUrl}/auto/buildMacth`,
    method: 'post',
    data,
    headers: jsonHeaders
  })
}
//保存ctf试题
export const saveCtfPaper = (data) => {
  return axios({
    url: `${competeUrl}/ctfPaper/save`,
    method: 'post',
    data,
    headers: jsonHeaders
  })
}

//ctf线上vpn保存试题
export const saveCtfPaperNew = (data) => {
  return axios({
    url: `${competeUrl}/ctfPaper/saveNew`,
    method: 'post',
    data,
    headers: jsonHeaders
  })
}

//场景构建进度
export const quickCreateProgress = (id) => {
  return axios({
    url: `${competeUrl}/auto/${id}/progress`,
    method: 'get',
    headers: jsonHeaders
  })
}
/**
 * 查询分批部署时的部署进度
 * @param projectId 指定需要查询的工程主键
 * @returns {*}
 */
export const getBatchDeployProgress = (projectId) => {
  return axios({
    url: `/auto-deploy/project/${projectId}`,
    method: 'get',
    headers: jsonHeaders
  })
}
/**
 * 重启或停止分批部署
 * @param projectId 指定需要操作的工程主键
 * @param action restart: 重启; stop: 停止
 * @returns {*}
 */
export const redeploy = (projectId, action) => {
  return axios({
    url: `/auto-deploy/project/${projectId}/${action}`,
    method: 'post',
    headers: jsonHeaders
  })
}
//场景构建进度
export const setautomatic = (id) => {
  return axios({
    url: `${competeUrl}/auto/group/Configuration/${id}`,
    method: 'post',
    headers: jsonHeaders
  })
}
export const reQuickCreateContent = (id, modeType, type) => {
  return axios({
    url: `${competeUrl}/auto/redeploy/${id}?&rebuild=${type}`,
    method: 'post',
    data: {
      // modeType:modeType,
      rebuild: type
    },
    headers: jsonHeaders
  })
}

//导出用户列表列表
export const outputUser = (projectId) => {
  return axios({
    url: `${competeUrl}/export/${projectId}`,
    method: 'get',
    responseType: 'blob',
    headers: jsonHeaders,
    timeout: 0
  })
}
/****************快速构建结束*******************/

// 分页查询设备的端口
export const getDevicePorts = (params) => {
  return axios({
    url: `topo-edit/ports`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}
// 查询指定设备的所有端口
export const getDevicePortsById = (deviceId) => {
  return axios({
    url: `topo-edit/ports/devices/${deviceId}`,
    method: 'get',
    headers: jsonHeaders
  })
}
//修改端口
export const modifyPort = (projectId, networkId, data) => {
  return axios({
    //  url: `topo-edit/projects/${projectId}/networks/${networkId}/ports`,
    url: `topo-edit/projects/${projectId}/networks/${networkId}/ports/changeIp`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

//获取公网子网列表
export const queryPublicSubnets = () => {
  return axios({
    url: `/topo-edit/public/subnets`,
    method: 'get',
    headers: jsonHeaders
  })
}

//从公共子网的可用范围ip中获取ip
export const getAvailableIP = (subnetId, count) => {
  return axios({
    url: `topo-edit/public/subnets/${subnetId}/ips/${count}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//生成并替换dns nginx配置文件
export const dnsConfig = (projectId, realmName, ip, data) => {
  return axios({
    url: `compete/domain/relaceConfig?projectId=${projectId}&domainName=${realmName}&extranetIp=${ip}`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

//重启dns
export const restartDns = (projectId) => {
  return axios({
    url: `compete/domain/restart?projectId=${projectId}`,
    method: 'post',
    headers: jsonHeaders
  })
}

//获取用户登录IP
export const getUserLoginIP = (userIds) => {
  return axios({
    url: `identity/company/users/sessions`,
    method: 'post',
    data: userIds,
    headers: jsonHeaders
  })
}

// 动态获取cpu信息
export const getmemdata = (params) => {
  return axios({
    url: `/data/kvm/capUsage`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}
//封禁
export const banAccessGroup = (accessGroupId, userIds) => {
  return axios({
    url: `/process/accessGroups/${accessGroupId}/users/ban`,
    method: 'put',
    data: userIds,
    headers: jsonHeaders
  })
}

// 新的封禁接口
export const banAccessGroup_new = (sceneId, teamId) => {
  return axios({
    url: `${competeUrl}/contest/bandContestTeam/${sceneId}/${teamId}`,
    method: 'post',
    headers: jsonHeaders
  })
}

//解禁
export const allowAccessGoup = (accessGroupId, userIds) => {
  return axios({
    url: `/process/accessGroups/${accessGroupId}/users/allow`,
    method: 'put',
    data: userIds,
    headers: jsonHeaders
  })
}

// 新的解禁接口
export const allowAccessGoup_new = (sceneId, teamId) => {
  return axios({
    url: `${competeUrl}/contest/releaseContestTeam/${sceneId}/${teamId}`,
    method: 'post',
    headers: jsonHeaders
  })
}

//根据id批量查询执行结果
export const getExecutionsResult = (ids) => {
  return axios({
    url: `remote/executions/ids`,
    method: 'post',
    data: ids,
    headers: jsonHeaders
  })
}
//综合演练题目统计（增加维度显示）--获取题目列表
export const getTargetListEr = (params) => {
  return axios({
    url: `${competeUrl}/target/comp/page`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}
export const getTeamInfoEr = (id, params) => {
  return axios({
    url: `${competeUrl}/target/comp/${id}`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}
//
export const getTeamListER = (id, params) => {
  return axios({
    url: `${competeUrl}/target/compTeam/${id}`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}
//获取虚拟机信息（单个）
export const getvmInfo = (id) => {
  return axios({
    url: `/topo-edit/deployed/vms/${id}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//场景归档
//将录屏转码并复制到指定目录
export const screenCopyTo = (params) => {
  return axios({
    url: `/access/storage/copyto`,
    method: 'post',
    params: params,
    headers: jsonHeaders
  })
}

//归档场景POST
export const sceneFiling = (sceneId, params) => {
  return axios({
    url: `${competeUrl}/record/${sceneId}`,
    method: 'post',
    data: params,
    headers: jsonHeaders
  })
}

//查询归档列表
export const getFilingList = (params) => {
  return axios({
    url: `${competeUrl}/record/page`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//删除归档
export const delFiling = (id) => {
  return axios({
    url: `${competeUrl}/record/${id}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//获取当前复制任务的进度
export const getCopyProgress = (params) => {
  return axios({
    url: `/access/storage/getProgress`,
    method: 'get',
    params: params,
    headers: jsonHeaders
  })
}

//下载归档文件
export const downloadFilingFile = (id) => {
  return axios({
    url: `${competeUrl}/record/downloadZip/${id}`,
    method: 'get',
    params: {},
    headers: {
      'Content-Type': 'application/json; application/octet-stream'
    },
    responseType: 'blob',
    timeout: 0
  })
}

/**
 * 批量操作靶标展示否是隐藏
 * @param ids 需要操作的靶标id组数
 * @param visibility 是否展示 0：隐藏；1：展示
 * @returns {{}|*}
 */
export const batchModificationStatus = (ids, visibility) => {
  return axios({
    url: `${competeUrl}/targetAllot/batch`,
    method: 'put',
    data: {
      ids,
      visibility
    },
    headers: jsonHeaders
  })
}

/**
 * 为新建的团队分配环境
 * @param sceneId 场景ID
 * @param groupTO 数据对象{partyId , partyName , teamId , teamName }
 * @returns {*}
 */
export const allotTopic2Team = ({ sceneId, groupTO }) => {
  return axios({
    url: `${competeUrl}/ctfGameBox/saveTeamGame/${sceneId}`,
    method: 'post',
    data: groupTO,
    headers: jsonHeaders
  })
}

/**
 * 查询团队的基础分
 * @param pageIndex 当前页
 * @param pageSize 分页大小
 * @param teamName 团队名搜索
 * @param sceneId 指定比赛ID
 * @returns {*}
 */
export const getTeamBasicList = ({ pageIndex = 1, pageSize = 10, teamName, sceneId }) => {
  return axios({
    url: `${competeUrl}/ctfTeamBasic`,
    method: 'get',
    params: {
      pageIndex,
      pageSize,
      teamName,
      sceneId
    },
    headers: jsonHeaders
  })
}

/**
 * 批量修改团队的基础分
 * @param sceneId 指定比赛ID
 * @param basicScore 修改后的团队分
 * @returns {*}
 */
export const updateTeamBasic = ({ sceneId, basicScore = 1000 }) => {
  return axios({
    url: `${competeUrl}/ctfTeamBasic`,
    method: 'post',
    data: {
      sceneId,
      basicScore
    },
    headers: jsonHeaders
  })
}

// 护网
export const updateCompanyBasic = (id, data) => {
  return axios({
    url: `${competeUrl}/ctfTeamBasic/${id}`,
    method: 'put',
    data,
    headers: jsonHeaders
  })
}

/**
 * 为指定题目加分或扣分
 * @param {*} addScore 加分或扣分
 * @param {*} id 指定题目ID
 * @returns
 */
export const addOrSub = ({ addScore, id }) => {
  return axios({
    url: `${competeUrl}/ctfGameBox/addOrSub`,
    method: 'post',
    data: {
      addScore,
      id
    },
    headers: jsonHeaders
  })
}

/**
 * 新的盲打模式，计算得分
 * @param {*} sceneId 指定场景ID
 * @returns
 */
export const calculateScore = (sceneId) => {
  return axios({
    url: `${competeUrl}/userSubmitRecord/blindCtf/${sceneId}`,
    method: 'post',
    headers: jsonHeaders
  })
}

/**
 * 初始化自动配置数据，生出步骤
 * @param {*} sceneId
 * @returns
 */
export const autoInit = (sceneId) => {
  return axios({
    url: `${competeUrl}/auto/init/${sceneId}`,
    method: 'post',
    headers: jsonHeaders
  })
}

/**
 * 查询配置结果列表
 * @param {*} param0
 * @returns
 */
export const getAutoStatus = ({
  sceneId,
  pageIndex = 1,
  pageSize = 10,
  sortBy = 'step',
  order = 'asc'
}) => {
  return axios({
    url: `${competeUrl}/auto/page`,
    method: 'get',
    params: {
      sceneId,
      pageIndex,
      pageSize,
      sortBy,
      order
    },
    headers: jsonHeaders
  })
}

/**
 * 自动配置
 * @param {*} sceneId
 * @returns
 */
export const autoConfig = (sceneId, domainName, refereeIds) => {
  return axios({
    url: `${competeUrl}/auto/${sceneId}`,
    method: 'post',
    data: {
      domainName,
      refereeIds
    },
    headers: jsonHeaders
  })
}

// 查询机器重置记录
export const getTargetResetRecords = (params) => {
  return axios({
    url: `${competeUrl}/targetRestRecord/page`,
    method: 'get',
    params,
    headers: jsonHeaders
  })
}

// 重置docker机器
export const resetDockerVm = (data) => {
  return axios({
    url: `${competeUrl}/targetRestRecord/intranet`,
    method: 'put',
    data,
    headers: jsonHeaders
  })
}

/**
 * 获取场景下的所有备用环境
 * @param {*} sceneId
 * @returns
 */
export const getSpareEnvList = (sceneId) => {
  return axios({
    url: `${competeUrl}/standbyEnv/${sceneId}/list`,
    method: 'post',
    headers: jsonHeaders
  })
}

/**
 * 攻防赛plus专用，以靶标为单位，展示或者隐藏分配的靶标
 * @param {*} sceneId
 * @param {*} data
 * @returns
 */
export const changeTargetVisibility = (sceneId, data) => {
  return axios({
    url: `${competeUrl}/target/batchUpdateTargetShowOrHide/${sceneId}`,
    method: 'put',
    headers: jsonHeaders,
    data
  })
}
// 批量修改竞赛场景下题目flag和分数
export const batchUpdateQuestionFlags = (sceneId, flags) => {
  return axios({
    url: `${competeUrl}/ctfGameBox/batchUpdateQuestion/${sceneId}`,
    method: 'put',
    data: flags,
    headers: jsonHeaders
  })
}

// 批量修改团队题目多个flag信息
export const batchUpdateTeamFlags = (flags) => {
  return axios({
    url: `${competeUrl}/ctfGameBox/batchUpdateTeamQuestionFlag`,
    method: 'put',
    data: flags,
    headers: jsonHeaders
  })
}
//获取可视化中所有topo信息
export const allNodeInfo = (prjId) => {
  return axios({
    url: `topo3d/project/${prjId}/layout/display`,
    params: {
      hasIp: true
    },
    method: 'get',
    headers: jsonHeaders
  })
}
//调用效果触发websoket推送
export const triggerEffect = (prjId, data) => {
  return axios({
    url: `/notice/internal/pushNettingData/${prjId}`,
    method: 'post',
    data,
    headers: jsonHeaders
  })
}
// 场景模板相关 --- 开始
// 将竞赛存为模板
export const sceneSaveAsTemplate = (sceneId, data) => {
  return axios({
    url: `${competeUrl}/sceneTemplate/saveSceneTemplate/${sceneId}`,
    data,
    method: 'post',
    headers: jsonHeaders
  })
}
// 导出场景模板
export const exportSceneTemplate = (sceneId) => {
  return axios({
    url: `${competeUrl}/sceneTemplate/exportSceneTemplate/${sceneId}`,
    params: {},
    method: 'get',
    headers: {
      'Content-Type': 'application/json; application/octet-stream'
    },
    responseType: 'blob',
    timeout: 0
  })
}

// 查询场景模板列表
export const getSceneTemplateList = (params) => {
  return axios({
    url: `${competeUrl}/sceneTemplate/page`,
    params,
    method: 'get',
    headers: jsonHeaders
  })
}

// 导入场景模板
export const importSceneTemplate = (data, params) => {
  return axios({
    url: `${competeUrl}/sceneTemplate/importSceneTemplate`,
    params,
    data,
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    timeout: 0
  })
}
//修改场景模板
export const updateSceneTemplate = (id, data) => {
  return axios({
    url: `${competeUrl}/sceneTemplate/update/${id}`,
    method: 'put',
    data,
    headers: jsonHeaders
  })
}

//删除场景模板
export const deleteSceneTemplate = (id) => {
  return axios({
    url: `${competeUrl}/sceneTemplate/${id}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//获取模板接入组信息
export const getSceneTemplateAccessGroup = (templateId) => {
  return axios({
    url: `${competeUrl}/sceneTemplate/queryTemplateForAccessGroups/${templateId}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//获取业务模板json
export const getSceneTemplateBusinessInfo = (businessTemplateId) => {
  return axios({
    url: `${competeUrl}/sceneTemplate/queryBusinessSceneTemplate/${businessTemplateId}`,
    params,
    method: 'get',
    headers: jsonHeaders
  })
}

//获取工程模板json
export const getSceneTemplateProjectInfo = (templateId) => {
  return axios({
    url: `${competeUrl}/sceneTemplate/queryTemplate/${templateId}`,
    params,
    method: 'get',
    headers: jsonHeaders
  })
}

//通过模板构建演练
export const quickBuildScene = (id, data) => {
  return axios({
    url: `${competeUrl}/sceneTemplate/quickBuildScene/${id}`,
    data,
    method: 'post',
    headers: jsonHeaders
  })
}
// 场景模板相关 --- 结束

/****     护网计分规则          ****/

//删除计分规则
export const deleteHWScoreRule = (ids) => {
  return axios({
    url: `${competeUrl}/scoring`,
    method: 'delete',
    data: ids,
    headers: jsonHeaders
  })
}

export const queryHWScoreRule = (sceneId, params) => {
  return axios({
    url: `${competeUrl}/scoring/page/${sceneId}`,
    method: 'get',
    params,
    headers: jsonHeaders
  })
}

export const addHWScoreRule = (data) => {
  return axios({
    url: `${competeUrl}/scoring/one`,
    method: 'post',
    data,
    headers: jsonHeaders
  })
}

export const updateHWScoreRule = (id, data) => {
  return axios({
    url: `${competeUrl}/scoring/${id}`,
    method: 'put',
    data,
    headers: jsonHeaders
  })
}

//获取护网计分规则攻击类型列表
export const queryHWAttackTypes = (sceneId, params) => {
  return axios({
    url: `${competeUrl}/scoring/all/${sceneId}`,
    method: 'get',
    params,
    headers: jsonHeaders
  })
}
/****     护网计分规则          ****/
/****     申报审核         ****/
export const queryDeclareTargetList = (sceneId, params) => {
  return axios({
    url: `${competeUrl}/declare/page/${sceneId}`,
    method: 'get',
    params,
    headers: jsonHeaders
  })
}

export const checkDeclareTarget = (id, checkStatus, params, data) => {
  return axios({
    url: `${competeUrl}/declare/${id}/${checkStatus}`,
    method: 'put',
    params: params,
    data: data,
    headers: jsonHeaders
  })
}

//获取申报单位列表
export const getDeclareCompanyList = (projectId) => {
  return axios({
    url: `${competeUrl}/declare/company/${projectId}`,
    method: 'get',
    params: {},
    headers: jsonHeaders
  })
}
/****     申报审核          ****/

//查询攻防Plus题目统计
export const queryProblemStatistics = (sceneId, params) => {
  return axios({
    url: `${competeUrl}/teamScoreRecord/plus/${sceneId}/page`,
    method: 'get',
    headers: jsonHeaders,
    params
  })
}

// 查询攻防详情/teamScoreRecord/plus/{sceneId}/detail/{id}/

export const getAttackDetail = (sceneId, id, params) => {
  return axios({
    url: `${competeUrl}/teamScoreRecord/plus/${sceneId}/detail/${id}/`,
    method: 'get',
    headers: jsonHeaders,
    params
  })
}

//查询周期列表
export const getCycleList = (sceneId, params) => {
  return axios({
    url: `/compete/cycle/page/${sceneId}`,
    method: 'get',
    params,
    headers: jsonHeaders
  })
}

//重置某个周期
export const resetCycle = (sceneId, cycleIds) => {
  return axios({
    url: `/compete/cycle/rest/${sceneId}`,
    method: 'put',
    data: cycleIds,
    headers: jsonHeaders
  })
}

//修改团队公网IP数
export const setAmendTeamIpNumber = (sceneId, count) => {
  return axios({
    url: `/compete/pub/setAvailableIpCount/${sceneId}/${count}`,
    method: 'put',
    headers: jsonHeaders
  })
}

//夺旗赛裁判分配题目
export const refereeAllotTarget = (data) => {
  return axios({
    url: `/compete/refereesAllot/batch`,
    method: 'post',
    data,
    headers: jsonHeaders
  })
}

//夺旗赛才配题目已分配列表
export const getRefereeAllotTargetList = (sceneId, params) => {
  return axios({
    url: `/compete/refereesAllot/page/${sceneId}`,
    method: 'get',
    params,
    headers: jsonHeaders
  })
}

//取消分配
export const cancelRefereeAllot = (ids) => {
  return axios({
    url: `/compete/refereesAllot`,
    method: 'put',
    data: ids,
    headers: jsonHeaders
  })
}

//清空分配
export const clearRefereeAllot = (sceneId) => {
  return axios({
    url: `/compete/refereesAllot/${sceneId}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//裁判查询夺旗赛报告列表分页
export const getRefereeCtfReportList = (sceneId, params) => {
  return axios({
    url: `/compete/refereesAllot/report/${sceneId}`,
    method: 'get',
    params,
    headers: jsonHeaders
  })
}

//裁判查询夺旗赛任务列表分页
export const getRefereeCtfTaskList = (params) => {
  return axios({
    url: `/compete/refereesAllot/task/page`,
    method: 'get',
    params,
    headers: jsonHeaders
  })
}

// 渗透题目撤销
export const stSubQuestion = (data, sceneId) => {
  return axios({
    url: `${competeUrl}/targetAllot/stSubQuestion/${sceneId}`,
    method: 'post',
    data: data,
    headers: jsonHeaders
  })
}

// 获取仿真项目信息
export const getFZInformation = (sceneId) => {
  return axios({
    url: `${competeUrl}/contest/getFZInformation/${sceneId}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//一键接入机器
export const autoConfigAccessVm = (sceneId) => {
  return axios({
    url: `${competeUrl}/auto/configAccessVm/${sceneId}`,
    method: 'post',
    data: {},
    headers: jsonHeaders
  })
}

//查询报告树
export const getReportsTree = (params) => {
  return axios({
    url: `/referee/referee/reportsTree`,
    method: 'get',
    params,
    headers: jsonHeaders
  })
}
